package com.jiang.daily.Q2274;

import java.util.Arrays;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/01/06 0:12
 */
class Solution {
    public int maxConsecutive(int bottom, int top, int[] special) {
        Arrays.sort(special);
        int len = special.length;
        int res = Math.max(special[0] - bottom, top - special[len - 1]);
        for (int i = 1; i < len; i++) {
            res = Math.max(res, special[i] - special[i - 1] - 1);
        }
        return res;
    }
}